/*
* Created by FDG416 on 2017/12/27.
*/ 
$(function(){
    /*del FDG416 2018/1/17 ID447 【商城需求】IE9以上版本做兼容调整 start*/ 
     /* 判断IE9的情况下加载的样式 */ 
     // if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE9.0") { 
         //     $('.video_div .video_text').removeClass('center-self-xy').addClass('video_margin');
         //     $('.slideshow_product .brand_s .left div').removeClass('center-self-xy').addClass('text_margin_t');
         // }
    /*del FDG416 2018/1/17 ID447 【商城需求】IE9以上版本做兼容调整 end*/ 
    /* 视频 */ 
    $('.video_text .icon_video').on('click',function(){
        var that = $(this);
        $(this).parents('.video_text').hide().siblings('#video_1').hide().siblings('#video_2').removeClass('hide');
        videojs('video_2', {
                "techOrder": ["html5"]
        },function(){
            /* mod FDG416 2018/1/9 ID438 【品牌专题页】VERSACE品牌专题页视频播放调整 pc start */ 
            var myPlayer = this;
            // mod FDG416 2018/2/13 ID514 【商城需求】品牌专题介绍页第二个视频播放时，增加停止按钮，按停止跳转至第一个视频界面 start
            $(".vjs-play-control").before('<button class="vjs_close_video" id="vjs_close_video"></button>');
            // myPlayer.on('play',function(){
                //        that.hide();
                // });
            myPlayer.play();
            $('#vjs_close_video').click(function(){
                $('#video_2').addClass('hide').siblings('.video_text').show().siblings('#video_1').show();
                $('#vjs_close_video').remove();
                var whereYouAt = myPlayer.currentTime();
                myPlayer.currentTime(0);
                myPlayer.pause();
                // mod FDG416 2018/2/13 ID514 【商城需求】品牌专题介绍页第二个视频播放时，增加停止按钮，按停止跳转至第一个视频界面 end
            })
            myPlayer.on("ended",function(){
                $('#video_2').addClass('hide').siblings('.video_text').show().siblings('#video_1').show();
            })
        /* mod FDG416 2018/1/9 ID438 【品牌专题页】VERSACE品牌专题页视频播放调整 pc end */ 
        })
    })
    /* 箭头下拉展开 */ 
    $('.tg_introduce').hover(function(){
        $(this).find('.gif_down').hide().siblings('p').stop().slideDown();
    },function(){
        $(this).find('.gif_down').show(500).siblings('p').stop().slideUp();
    })
    /* 轮播图左右箭头 */ 
    $('.tiamantti-g').hover(function(){
        $('.swiper-button-prev').removeClass('hide').siblings('.swiper-button-next').removeClass('hide');
        $('.swiper-button-prev').hover(function(){
            $(this).find('img').attr('src',image_bath_url+'/static/pc/image/img/left.png');
        },function(){
            $(this).find('img').attr('src',image_bath_url+'/static/pc/image/img/left01.png');
        })
        $('.swiper-button-next').hover(function(){
            $(this).find('img').attr('src',image_bath_url+'/static/pc/image/img/right.png');
        },function(){
            $(this).find('img').attr('src',image_bath_url+'/static/pc/image/img/right01.png');
        })
    },function(){
        $('.swiper-button-prev').addClass('hide').siblings('.swiper-button-next').addClass('hide');
    })
    /* 展厅轮播图 */ 
    var banners = new Swiper('#banner', {
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        autoplay: 3000,
        speed:1000,
        effect : 'fade',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false

    });
    var viaGesu = new Swiper('#via_gesu', {
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        // autoplay:3000,
        speed:1000,
        effect : 'slide',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false

    });
    var viaGesu = new Swiper('#medusa', {
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        // autoplay:3000,
        speed:1000,
        effect : 'slide',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false

    });
    var viaGesu = new Swiper('#bathrobe', {
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        // autoplay:3000,
        speed:1000,
        effect : 'slide',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false

    });
    /*mod FDG416 2018/03/06 ID532 【商城需求】轮播图（焦点图）的落地页：CURTAINS & WALLPAPER改轮播图，PARTNER BRANDS更换图片，TIAMANTTI LUXURY更换图片 start */ 
    var viaGesu = new Swiper('#partner_five', {
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        // autoplay:3000,
        speed:1000,
        effect : 'slide',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false
        
    });
    /*mod FDG416 2018/03/06 ID532 【商城需求】轮播图（焦点图）的落地页：CURTAINS & WALLPAPER改轮播图，PARTNER BRANDS更换图片，TIAMANTTI LUXURY更换图片 end */ 

    /* add FDG416 2018/2/12 ID517 【商城需求】首页轮播图第一张可链接是落地页 start */ 
    var viaGesu = new Swiper('#partner_six', {
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        // autoplay:3000,
        speed:1000,
        effect : 'slide',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false

    });
    var viaGesu = new Swiper('#studio_seven', {
        direction: 'horizontal',
        pagination : '.swiper-pagination',
        // autoplay:3000,
        speed:1000,
        effect : 'slide',
        loop:true,
        paginationClickable :true,
        autoplayDisableOnInteraction:false

    });
    $('.tia_liv .video_text .tialiv_icon_video').on('click',function(){
        var that = $(this);
        $(this).parents('.video_text').hide().siblings('#video_1').hide().siblings('#video_2').removeClass('hide');
        videojs('video_2', {
            "techOrder": ["html5"]
        },function(){
            var myPlayer = this;
            $(".vjs-play-control").before('<button class="vjs_close_video" id="vjs_close_video"></button>');
            myPlayer.play();
            $('#vjs_close_video').click(function(){
                $('#video_2').addClass('hide').siblings('.video_text').show().siblings('#video_1').show();
                $('#vjs_close_video').remove();
                var whereYouAt = myPlayer.currentTime();
                myPlayer.currentTime(0);
                myPlayer.pause();
            })
            myPlayer.on("ended",function(){
                $('#video_2').addClass('hide').siblings('.video_text').show().siblings('#video_1').show();
            })
        })
    })
    /*add FDG416 2018/2/12 ID517 【商城需求】首页轮播图第一张可链接是落地页 end */ 
})